
const apiURL = 'https://www.rangcn.press';

const wxRequest = (params, url) => {
  wx.request({
    url,
    method: params.method || 'GET',
    data: params.data || {},
    header: {
      Accept: 'application/json',
      'Content-Type': 'application/json',
    },
    success(res) {
      if (params.success) {
        params.success(res);
      }
    },
    fail(res) {
      if (params.fail) {
        params.fail(res);
      }
    },
    complete(res) {
      if (params.complete) {
        params.complete(res);
      }
    },
  });
};



const sendCode = (params) => {
    wxRequest(params, `${apiURL}/doudou/sendcaptcha`)
}

const login = (params) => {
  wxRequest(params, `${apiURL}/doudou/clientlogin`)
}
const login2 = (params) => {
  wxRequest(params, `${apiURL}/doudou/login`)
}

const contractinfolist = (params) => {
    wxRequest(params, `${apiURL}/zy/contractinfolist`)
  }

const updateimg = (params) => {
    wxRequest(params, `${apiURL}/updateimg`)
}

module.exports = {
  sendCode,
  login,
  login2,
  contractinfolist,
  updateimg
};